/*
 * @Author: your name
 * @Date: 2021-08-13 14:45:28
 * @LastEditTime: 2021-08-13 14:56:25
 * @FilePath: /wx-weapp/enhancer/utils/observer.js
 */

  /**
   * 劫持对象
   * @param {Object} obj
   * @param {String} key
   * @param {any} val
   * @param {Boolean} enumerable
   */
   export function def(obj, key, val, enumerable) {
    Object.defineProperty(obj, key, {
      value: val,
      enumerable: !!enumerable,
      writable: true,
      configurable: true,
    });
  }

  /**
   * Remove an item from an array.
   * @param {Array<any>} arr
   * @param {any} item
   * @returns {Array<any> | void}
   */
   export function remove(arr, item) {
    if (arr.length) {
      const index = arr.indexOf(item);
      if (index > -1) {
        return arr.splice(index, 1);
      }
    }
  }
 
